<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/6/7 0007
 * Time: 上午 11:15
 * 视图要用ActiveForm类,注意引用对应的类
 */
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use yii\widgets\LinkPager;//分页
use app\common\Functions;
use kartik\select2\Select2;
use yii\web\JsExpression;
use yii\bootstrap\Modal;//弹窗引用类
use kartik\date\DatePicker;
?>


<div>
    <div class="content">

        <div class="row">

            <input type="button" class="btn btn-lg btn-primary h2" value="数据导出">

        </div>
        <br/>
        <div class="row">
            <?php

            $datetime = new \DateTime();
            $interval = \DateInterval::createFromDateString('last month');
            $period = new \DatePeriod($datetime, $interval, 6,DatePeriod::EXCLUDE_START_DATE);
            foreach ($period as $date) {
                echo "<a  href=/myyii/myyii/index?object_id=1&time=".$date->format('Y-m'), PHP_EOL."><button class='btn btn-lg btn-success' >".$date->format('Y-m')."</button></a>&nbsp";

            }

            ?>
            <div class="pull-right" style="width: 300px;">
                <a href="#" style="float: right;" id="goto">
                    <button class="btn btn-warning btn-flat" id="go">查找</button>
                </a>
                <?= DatePicker::widget([
                    'name' => 'time',
                    'value' =>'',
                    'id'=>'time',
                    'pluginOptions' => [
                        'autoclose' => true,
                        'todayHighlight' => true,
                        'format' => 'yyyy-mm-dd',
                    ]
                ]);?>

            </div>

        </div>

    </div>


    <table class="table table-bordered">
        <tr>
            <th class="col-sm-1">公司</th>
            <th class="col-sm-1">
                <i class="col-sm-6">录入时间</i>
                <i class="col-sm-6">咨询方式</i>
            </th>

            <th class="col-sm-1">
                <i class="col-sm-4">姓名</i>
                <i class="col-sm-8">手机</i>
            </th>

            <th class="col-sm-1">
                <i class="col-sm-6">需求面积</i>
                <i class="col-sm-6">意向区域</i>
            </th>

            <th class="col-sm-1">租金预算</th>
            <th class="col-sm-1">行业类型</th>
            <th class="col-sm-1">信息来源</th>
            <th class="col-sm-2">
                <i class="col-sm-3">装修</i>
                <i class="col-sm-3">状态</i>
                <i class="col-sm-3">招商员</i>
                <i class="col-sm-3">录入员</i>
            </th>

            <th class="col-sm-1">
                <i class="col-sm-6">咨询时间</i>
                <i class="col-sm-6">客源编号</i>
            </th>

            <th class="col-sm-2">备注</th>
        </tr>
        <?php foreach ($regions as $k=>$region ): ?>

            <tr>
                <td class="col-sm-1">
                    <?= $region['inf']?>

                </td>
                <td class="col-sm-1">
                    <i class="col-sm-6"><?= $region['time'] ?></i>
                    <i class="col-sm-6"><?= $region['conm'] ?></i>

                </td>
                <td class="col-sm-1">
                    <i class="col-sm-4"><?= $region['name'] ?></i>
                    <i class="col-sm-8"><?= $region['cell'] ?></i>

                </td>
                <td class="col-sm-1">
                    <i class="col-sm-6"><?= $region['actual'] ?></i>
                    <i class="col-sm-6"><?= $region['yx'] ?></i>

                </td>

                <td  class="col-sm-1">
                    <?= $region['rent ']?>
                </td>
                <td class="col-sm-1">
                    <?= $region['industry'] ?>
                </td>
                <td class="col-sm-1">
                    <?= $region['source'] ?>
                </td>
                <td class="col-sm-2">
                    <i class="col-sm-3"><?= $region['finish'] ?></i>
                    <i class="col-sm-3"><?= $region['zt'] ?></i>
                    <i class="col-sm-3"><?= $region['attract'] ?></i>
                    <i class="col-sm-3"><?= $region['keyboarder'] ?></i>

                </td>
                <td class="col-sm-1">
                    <i class="col-sm-6"><?= $region['input_time'] ?></i>
                    <i class="col-sm-6"><?= $region['num'] ?></i>
                </td>
                <td class="col-sm-2">
                    <?= $region['remark'] ?>
                </td>
            </tr>

        <?php endforeach; ?>

    </table>





</div>

<?php
$js = <<<JS
jQuery('#go').on('click',function() {

    $('#goto').attr('href',"/myyii/myyii/index?object_id=1&a_time="+$('#time').val());
});
JS;
$this->registerJs($js);

$js = <<<JS
jQuery('.h2').on('click',function() {
    $.get(
        '/myyii/myyii/export',
        {

        },
        function (data) {

        }
    );
});
JS;
$this->registerJs($js);

?>



